<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>相对定位</title>
</head>
<style>
    .container {
        width: 400px;
        height: 400px;
        background-color: gray;
        padding: 20px;
    }

    div > div {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .box_1 {
        background-color: lightcyan;
    }

    /*相对定位是相对自己的位置进行定位*/
    .box_2 {
        background-color: skyblue;
        position: relative;
        top: 120px;
        left: 120px;
    }

    .box_3 {
        background-color: aquamarine;
    }

    /*将内容水平垂直居中*/
    span{
        display: flex;
        height: 100%;
        width: 100%;
        justify-content: center;
        align-items: center;
    }
</style>
<body>
<div class="container">
    <div class="box_1"><span>1111</span></div>
    <div class="box_2"><span>2222</span></div>
    <div class="box_3"><span>3333</span></div>
</div>
</body>
</html>